import React, { Component } from 'react'
import Son from './son'
import Model from './model'
export default class index extends Component {
  state = {
    show: false,
  }
  constructor(props) {
    super(props);
    this.state = {
      show: false,
    }
  }
  render() {
    return (
      <div>
        <h1>我是跟组件</h1>
        <Son s1={<p>我是放在儿子属性上的内容</p>}>
          <p>我是父组件给儿子组件给的10块钱</p>
        </Son>
        <hr />
        <button onClick={() => this.setState({ show: true })}>
          打开模拟框
        </button>
        {this.state.show ? (
          <Model
            header="模拟动态"
            content="自定义"
            onClose={() => this.setState({ show: false })} />
        ) : null}
      </div>
    )
  }
}
